import { reqCategoryList,reqGetBannerList,reqGetFloorList } from "@/api"
const state = {
    categoryList:[],
    bannerList:[],
    floorList:[]
}
const actions ={
    async getCategoryList({commit}){
         let reslut = await reqCategoryList();
         if(reslut.code == 200){
            //  需要获取到请求回来的data数据是一个对象
            commit('GETCATEGORYLIST',reslut.data)
         }
    },
    async getBannerList({commit}){
        let result = await reqGetBannerList();
        if(result.code == 200){
            commit('GETBANNERLIST',result.data)
        }
    },
    async getFloorList({commit}){
        let result = await reqGetFloorList();
        if(result.code==200){
            commit('GETFLOORLIST',result.data)
        }
    }
}
const mutations ={
    GETCATEGORYLIST(state,value){
        state.categoryList = value;
    },
    GETBANNERLIST(state,bannerList){
        state.bannerList = bannerList;
    },
    GETFLOORLIST(state,floorList){
        state.floorList = floorList;
    }
}
const getters ={}
export default {
    state,
    actions,
    mutations,
    getters
}